class Document < ActiveRecord::Base
	has_many :children,:class_name=>"Document",:foreign_key=>"parent_id"
	belongs_to :parent,:class_name=>"Document",:foreign_key=>"parent_id"
	belongs_to :member
	belongs_to :plan
	belongs_to :party
	#acts_as_tree :order => "create_date"
	def self.depth=
		if(parent_id?) then
			Document.find_by_parent_id(:parent_id).depth+1
		else
			1
		end
	end
end
